﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form4 : Form
    {
        public Form4()
        {
            InitializeComponent();
        }
        private int id;
        private void button1_Click(object sender, EventArgs e)
        {
            var Id = textBox1.Text;
            var Name = textBox2.Text;
            var age = textBox3.Text;

            if (id > 0)
            {

            }
            else
            {
                if (!string.IsNullOrEmpty(Name))
                {
                    var sql = string.Format("insert into Stsdents(Name,age) values('{0}',{1})",Name,age);
                    var res = DbHelper.AddOrEdiSave(sql);

                    if (res == 1)
                    {
                        MessageBox.Show("添加成功");
                    }
                    else
                    {
                        MessageBox.Show("添加失败");
                    }
                    this.Close();
                }
            }

           
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
